package com.example.springboot_demo.pojo;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;

/**
 * @author 江岸
 * @version V1.0
 * @ClassName: ContrastBean
 * @description:
 * @date 2020/12/99:51
 * @since V1.0
 */
@Document(collection = "ContrastBean")
public class ContrastBean {
    /**
     * 图表中显示，在以下方面存在显著差异：主题(名词短语). 如图表所示，A的百分比项 是所有类别中最大的。相比之下，B项 和C项 分别占xx%和xx%。
     *
     *
     *
     * 根据图表所提供的数据，有关数据存在显著变化主题 在过去的几年里。年数字年份, 数字项 是数字, 当它逐渐上升/下降（连续）时。然而，在此期间，B.出现了急剧的增加/减少，达到数据在里面某年.
     *
     *
     *
     * 是什么导致了这种现象？我想强调以下几点。首先，由于持久的经济繁荣，普通人的生活水平一直在不断提高，这是这一现象发生的必要先决条件。更重要的是，随着人们基本需求的显著满足，他们推动并迫使更高层次的需求出现，从而促进了这一现象的显著发生。最后但并非最不重要的一点是，新世纪的曙光见证了这一现象的日益流行。
     *
     *
     *
     * 如上所述，看到这种情况并不奇怪。可以预测，目前的情况在今后几年将持续相当一段时间。
     */

    @Id
    private String productId;
    private String productName;
    /**
     * 模板名称
     */
    private String templateName;

    //是否展示详版 0:不展示,1:展示
    private String isDesc;

    private List<ItemBean> itemBeans;

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public List<ItemBean> getItemBeans() {
        return itemBeans;
    }

    public void setItemBeans(List<ItemBean> itemBeans) {
        this.itemBeans = itemBeans;
    }

    public String getIsDesc() {
        return isDesc;
    }

    public void setIsDesc(String isDesc) {
        this.isDesc = isDesc;
    }

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    /**
     * It is presented in the chart that there exists a significant difference in terms of主题(名词短语).
     * As is illustrated by the chart,the percentage of A项 is the largest among all the categories.
     * In comparison, B项 and C项 take up account for xx% and xx% respectively.
     *
     * Based upon the data provided by the chart, there exist striking changes concerning the 主题 during the past few years.
     * In the year of 数字年份, the number of A项 was 数字, while it went progressively up/down.
     * In the meantime, however, the B项 has experienced a dramatic increase/ decrease,reaching to 数据 in 某年.
     *
     * What might contribute to this phenomenon? I would like to lay emphasis on the points as follows.
     * For a start, owing to an economic boom that is durable and lasting, the living standards of ordinary people have been rising consistently,
     * which turns out to be an essential prerequisite for this phenomenon's happening.
     * What's more, with basic needs of people significantly satisfied, they drive and force higher-level needs to emerge,
     * thus facilitating the observable occurrence of this phenomenon. Last but not least,
     * the dawn of the new century witnessed the increasing popularity of this phenomenon.
     *
     * As discussed above , it is no surprise to see this situation.
     * And it can be predicted that the present situation will continue for quite a while in the following years.
     * @param args
     */
    public static void main(String[] args) {
        StringBuilder str = new StringBuilder();
        InputStream inputStream = null;
        try {
            URL url = new URL("path");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            //设置超时间为3秒
            conn.setConnectTimeout(3 * 1000);
            //得到输入流
            inputStream = conn.getInputStream();

            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
            while (true) {
                String line = reader.readLine();
                if (line == null)
                    break;
                str.append(line);
            }
            if (reader != null) {
                reader.close();
            }
            if (inputStream != null) {
                inputStream.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
